An imaging apparatus, such as a digital still camera, which digitizes and compresses an image signal as image data obtained by capturing an image and stores the image data in a semiconductor memory has been put in the market.
The image data is produced from various still images including an image having a luminance signal with a lot of edges, i.e., having a fine texture, and an image having a luminance signal with a few edges, i.e., having a simple texture. The image data is compressed at a constant rate and recorded as an image file in a recording medium, such as a semiconductor memory card having a flash memory or a non-volatile memory. The image files may not have the same file sizes. An image having a lot of edges creates an image file having a large file size. The image files stored in a recording medium have their file sizes different from each other.
If a recording medium having a predetermined capacity stores the image files having various file sizes, the number of images stored in the medium varies, and the number of images storable in the medium cannot be controlled accurately.
As a method for managing the image files easily, the file size of an image file of a still image may be fixed. Such conventional image data compressing apparatus for making the file size fixed is disclosed in Japanese Patent Laid-Open Publication No.10-66004.
FIG. 5 is a block diagram of the conventional image data compressing apparatus. An image data compressor 51 performs a first image data compressing operation for compressing image data of a sample area in a still image and a second image data compressing operation of compressing data of the entire area of the still image. A file-size-evaluating unit 52 calculates an evaluation value from a file size of first image data provided through the first image data compressing operation of the image data compressor 51. According to the evaluation value, a compression-rate determining unit 53 determines a compression rate for the second image data compressing operation. A memory unit 54 includes a first memory 54A for temporarily storing the data of the input still image and a second memory 54B for storing second image data file provided through the second image data compressing operation. A recording medium 55, such as a memory card, stores the second image data file provided through the second image data compressing operation.
FIG. 6 is a flowchart of a routine for estimating the file size in the conventional image data compressing apparatus. Image data of a block consisting of for predetermined pixels of an input image is sampled (Step S60), and then, luminance data of the block of the four pixels are generated (Step S61). The luminance data are subjected to a discrete cosine transform (DCT) process (Step S62). A Huffman table is initialized (Step S63), and the compression rate (Q factor) is set to “95” (Step S64). The luminance data subjected to the DCT process is quantized (Step S65), and is Huffman-encoded (Step S66). It is then examined whether or not a predetermined number (e.g. seventy) of blocks are subjected to operations of Steps S60 to S66 (Step S67). If not, the operations of Steps S60 to S66 are repeated. When the above processes are completed at Step S67, an evaluation value H is calculated (Step S68) and is used for determining the Q factor to compress the entire data of the input image (Step S69).
A portion of the image data stored in the first memory 54A is compressed through the first compressing operation of the image data compressor 51, and the compressed data is stored in the second memory 54B. In the first image data compressing operation, at Step S60 of FIG. 6, the image data compressor 51 compresses the seventy blocks each having four pixels of the input image. The compression rate here, a first Q factor, is fixed to “95” set at Step S64.
Then, the file-size-evaluating unit 52 estimates the size of data obtained by compressing the entire data of the input image from the evaluation value H. The compression-rate-determining unit 53 then determines the compression rate, a second Q factor, for the second data compressing operation. Then, the image data compressor 51 performs the second image data compressing operation of compressing the image data stored in the first memory at the second Q factor. The compressed image data is stored in the second memory 54B and the recording medium 55, such as a memory card, according to requirement.
The data size of the compressed image data of the entire image is estimated based on to a ratio of areas according to the data size provided through the first data compressing operation. The data size after the compressing operation changes in response to the Q factor. In the estimation of the data size, an inclination of the change of the data size varies depending on a texture of the image. Therefore, the estimation of the data size based on the ratio of the areas may be significantly different from the actual compressed data size. In this case, a third data compressing operation is performed for further decreasing the data size. In addition, the blocks selected for the first data compressing operation may not represent an average of the luminance of the entire image. In either case, three of compressing operations is needed. This operations increases the duration of the process for recording the image data in the recording medium 55, thus consuming more electric power.